import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);
const modules = {};

const context = require.context("../views", true, /store\/index\.(js|ts)$/);
context.keys().forEach((key) => {
  modules[key.replace(/^\.\/|\/store\/index\.(js|ts)$/g, "")] = { namespaced: true, ...context(key).default };
});

const store = new Vuex.Store({
  modules,
  strict: true,
});

export default store;
